<html>
<head>
<title>Certificate error</title>
</head>
<body>
  <p>${reason}</p>
  <button id="leave" onclick="history.back()">Go back (recommended)</button>
  <button id="allow">Allow certificate temporarily</button>
  <div style="word-break: break-all; font-family: monospace" id="bytes">${bytes}</div>
  <script>
    let bytes = document.getElementById('bytes').textContent;
    let button = document.getElementById('allow');
    let exitButton = document.getElementById('leave');
    if (bytes.length) {
        button.onclick = function() {
            let xhr = new XMLHttpRequest();
            xhr.open('POST', 'chrome:allowcert');
            xhr.onloadend = function() {
                location.reload(true);
            };
            xhr.send("${secret}&${bytes}");
        };
    } else {
        button.style.display = "none";
    }
  </script>
</body>
</html>
